﻿// aSwitchValue
//Prop_CheckCode3 Prop_UseOncePSW6 Prop_TipsMode22 Prop_UsePreviousBt23 Prop_ProgressDisplay24 Prop_EnSubmitStatus29 Prop_SubmitStatusText30

var F = {};
F.I = [];
F.aIList = [];
F.sIList = "";
F.O = [];
F.P = [];
F.aSwitchValue =[];
F.iCurrPage = 1;
F.iPageNum = 1;
F.iProgressUnit = 0;//0无进度 1以页为单位 2以题为单位
F.iProgressShowMode = 0;//0显示分数比例 1显示百分比 2显示比例及百分比
F.Logic = [];
F.sLogic='';
F.sItemLogic='';
F.sURLPara='';
F.sDropDownBox='';
F.sMultiReject='';
F.sPSK='';
F.sAnswerQuote='11';
F.aAnswerQuote = [];
F.sOverPage = "";
F.$v = PublicLib.$V;
F.aLoginPath = [];
F.autoHiddenItem = "";
F.sOverItem = "";
document.write('<script type="text/javascript" id="bdshare_js" data="type=slide&amp;img=3" ></script><script type="text/javascript" id="bdshell_js"></script>');
F.SlipSelect = function(){
	var drago = null;
	var mo=null;
	var LeftPosi = 0;
	var RightPosi = 0;
	var sFn = "";
	var iCell = 0;
	var iLevelNum = 0;
	
	function closeItem(eX,StartX,CellWidth,o){
		var iPosiNum = getPosiNum(eX,aPosi);
		o.style.left = (StartX+CellWidth*iPosiNum)+"px";
		eval(sFn.replace("vvv","iPosiNum"));
	}
	
	var aPosi = [];
	function getPosiList(iWidth,iOffsetWidth,iNum){
		iCell = parseInt(iWidth/(iNum-1));
		var aResult = [];
		for(var i=0;i<iNum;i++){
			aResult[i]	 = [];
			aResult[i][0] = i==0?-10000:iOffsetWidth+i*iCell-iCell/2;
			aResult[i][1] = i==iNum-1?100000:iOffsetWidth+i*iCell+iCell/2;	
		}
		return aResult;
	}
	
	function getPosiNum(x,arr){
		for(var i=0;i<arr.length;i++){
			if((x>=arr[i][0])&&(x<arr[i][1])){
				return i;
			}
		}
		return null;
	}
	
	
	var getMouseOffset = function (target, e){
		var docPos    = ui.getPosi(target);
		var mousePos  = ui.mouseCoords($EU.getEvent(e));
		return {x:mousePos.x - docPos.left, y:mousePos.y - docPos.top};
	};
	
	this.omm = function(e){
		if(drago){
			e = $EU.getEvent(e);
			drago.style.position = "absolute";
			if((e.clientX-mo.x)<LeftPosi){
				drago.style.left = (LeftPosi)+"px";	
			}
			else if((e.clientX-mo.x)>RightPosi){
				drago.style.left = RightPosi+"px";	
			}
			else{
				drago.style.left = (e.clientX-mo.x)+"px";	
			}
		}
	}
	this.omu = function(e){
		if(drago){
			closeItem(e.clientX,LeftPosi,iCell,drago);
			drago = null;	
		}
	}
	$EU.addHandler(document,"mousemove",this.omm);
	$EU.addHandler(document,"mouseup",this.omu);
	this.createDrag = function(o,refObj,fn,LevelNum){
		LeftPosi = ui.getPosi(refObj).left-Math.floor((o.offsetWidth/2));
		RightPosi = LeftPosi+refObj.offsetWidth;
		o.onmousedown = function(event){
			drago = o;
			sFn = fn;
			mo = getMouseOffset(o,event);
			mo.y += ui.getScrollTop(o);
			aPosi = getPosiList(refObj.offsetWidth,LeftPosi,LevelNum);
			return false;
		}
	}
	
	this.autoMove = function(o,refObj,LevelNum,iPosiNum){
		o.style.position = "absolute";
		o.style.left = (  ui.getPosi(refObj).left-Math.floor((o.offsetWidth/2)) + parseInt(refObj.offsetWidth/(LevelNum-1))*iPosiNum)+"px";
	}
}
F.Msg = [];
F.Msg["Empty"] = "不能为空";
F.Msg["Input"] = "输入项不能为空";
F.Msg["Select"] = "必须选择";
F.Msg["Int"] = "必须为整数";
F.Msg["Real"] = "必须为数字";
F.Msg["Email"] = "必须为Email";
F.Msg["Post"] = "必须为邮编";
F.Msg["Cn"] = "必须为中文";
F.Msg["En"] = "必须为英文";
F.Msg["Date"] = "必须为日期格式";
F.Msg["Mob"] = "必须为手机号";
F.Msg["IDCard"] = "必须为身份证";
F.Msg["LimitValue"] = "必须介于$Min-$Max之间";
F.Msg["SelectNum"] = "选择数必须介于$Min-$Max之间";
F.Msg["Len"] = "长度必须介于$Min-$Max之是";
F.Msg["ListInput"] = "至少应该输入$Num项";
F.Msg["FT"] = "文件不在允许的范围（$FT）之内。";
F.Msg["LimitTotal"] = "合计值必须等于$LimitTotal";

F.clearAnswer = function(pageno){
	var oList = $("Page_"+pageno).getElementsByTagName("INPUT");
	for(var i=0;i<oList.length;i++){
		switch(oList[i].type){
			case "radio":
			case "checkbox":
				oList[i].checked = false;
				F.doDisabled(oList[i].getAttribute("DisabledValue"),false);
				break;
			case "text":
				oList[i].value = "";
				break;
			case "file":
				oList[i].value = "";
				break;
		}
	}
	oList = $("Page_"+pageno).getElementsByTagName("SELECT");
	for(var i=0;i<oList.length;i++){
		switch(oList[i].type){
			case "select-one":
				oList[i].selectedIndex = 0;
				break;
			case "select-multiple":
				var oc = oList[i].childNodes;
				for(var j=0;j<oc.length;j++){
					oc[j].selected = false;
				}
				break;	
		}
	}
	oList = $("Page_"+pageno).getElementsByTagName("TEXTAREA");
	for(var i=0;i<oList.length;i++){
		oList[i].value = "";
	}
}

F.initPage = function(iPageNum,iDefaultPage){
	for(var i=1;i<=iPageNum;i++){
		$("Page_"+i).style.display = "none";
	}
	$("Page_"+iDefaultPage).style.display = "block";
}

document.onclick = function(e){
	if(e==undefined){
		e = window.event;
		//IE中会出现e==undefined的情况，估计是事件委托方面的问题
		//return;
	}
	var t = $EU.getTarget($EU.getEvent(e));	
	//document.title = t.id
	F.doDisabled(t.getAttribute("DisabledValue"),t.checked);
	//使用NotIsOQSSObj为空来区另是否来自于OQSS源生的控件，以便于判断相应的动作，外来的控件必须要加入NotIsOQSSObj属性，如果有此属性则表示不是OQSS源生的控件，如果无此属性，则为OQSS源生的控件
	if(    ((t.type=="radio")||(t.type=="checkbox"))  ||   ((t.type=="button"))&&(t.getAttribute("IsHot")=="Yes")){
		
		F.doAction(e);
	}
}

//检查问卷完整性
F.checkFormIntegrity = function(){
	var a = F.sIList.split(",");
	var b = c = d =[];
	var j = n = m = IT = 0;
	for(var i=0;i<a.length;i++){
		F.I[a[i]][9] = $("IBox"+a[i]);
		IT = F.I[a[i]][0];
		switch(IT){
			case 1:case 2:case 3:case 17:case 25:case 6:case 10:case 12:
				if(!$("I"+a[i])){alert("问卷不完整"+a[i]);return;}	
				break;
			case 4:case 5:case 8:case 9:case 11:case 26:case 27:
				b = F.I[a[i]][5].split(",");
				for(j=0;j<b.length;j++){
					if(!$("I"+a[i]+"_"+b[j])){alert("问卷不完整");return;}
				}
				if((IT==5)||(IT==9)){
					if(!$("I"+a[i]+"_Input")){alert("问卷不完整");return;}	
				}
				if((IT==26)||(IT==27)){
					for(j=0;j<b.length;j++){
						if(!$("I"+a[i]+"_Input_"+b[j])){alert("问卷不完整");return;}
					}
				}
				break;
			case 7:case 15:case 19:case 20:case 22:case 16:
				b = F.I[a[i]][5].split(",");
				c = F.I[a[i]][6].split(",");
				for(n=0;n<c.length;n++){
					for(j=0;j<b.length;j++){
						if(!$("I"+c[n]+"_"+b[j])){alert("问卷不完整");return;}	
					}
				}
				break;
			case 23:
				b = F.I[a[i]][5].split(",");
				c = F.I[a[i]][6].split(",");
				for(j=0;j<b.length;j++){
					if(!$("I"+a[i]+"_"+b[j]+"_0")){alert("问卷不完整"+"I"+c[n]+"_"+b[j]+"_0");return;}	
				}
				break;
			case 13:
				if($n("I"+a[i]).length<=0){alert("问卷不完整");return;}	
				break;
			case 18:
				c = F.I[a[i]][6].split(",");
				d = F.I[a[i]][7].split(",");
				for(n=0;n<c.length;n++){
					for(j=0;j<d.length;j++){
						if(!$("I"+c[n]+"_"+d[j])){alert("问卷不完整");return;	}	
					}
				}
				break;
			case 24:
				b = F.I[a[i]][5].split(",");
				c = F.I[a[i]][6].split(",");
				d = F.I[a[i]][7].split(",");
				for(n=0;n<c.length;n++){
					for(j=0;j<d.length;j++){
						for(m=0;m<b.length;m++){
							if(!$("I"+c[n]+"_"+d[j]+"_"+b[m])){alert("问卷不完整");return;}
						}
					}
				}
				break;
		}
	}
}


window.onload = function(){	

	F.checkFormIntegrity();
	if(F.iPageNum==1){
		$("PreviousBt").style.display =$("NextBt").style.display = "none";
	}
	F.setPageBtStatus(1,F.iPageNum);
	if(F.aSwitchValue[5]=="1"){//如果设置了提交状态显示
		ui.initMask("MaskLayer");
		ui.switchMask("none");
		$("MaskLayer").style.zIndex = "1";
		
	}
	F.initPage(F.iPageNum,1);	
	if(F.sIList.lastIndexOf(",")==(F.sIList.length-1)){
		F.sIList = F.sIList.substr(0,F.sIList.length-1);
	}
	
	F.aIList = F.sIList.split(",");
	F.initAnswerQuote(F.sAnswerQuote);
	var a = F.initItemArr(F.aIList,F.I,F.iPageNum,F.P);
	
	F.I = a[0];
	F.P = a[1];
	F.initImgBt(F.aIList,F.I);
	if(F.aSwitchValue[3]=="1"){$EU.addHandler($("PreviousBt"),"click",F.prevPage);}else{$("PreviousBt").style.display = "none";}
	if(F.sLogic!=""){$("PreviousBt").style.display = "none";}
	$EU.addHandler($("NextBt"),"click",F.nextPage);
	$("oqssform").onsubmit=function(){return F.submitForm(F.aSwitchValue[2],F.I,F.aIList);};
	F.Logic= F.initLogic(F.sLogic,F.iPageNum);
	F.initItemLogic(F.sItemLogic);
	F.initURLPara(F.sURLPara);
	F.initDropDownBox(F.sDropDownBox);
	F.initMultiReject(F.sMultiReject);
	F.initPSK(F.sPSK);
	F.createProgress(F.aSwitchValue[4],F.iPageNum,F.iCurrPage);
	F.initAction();
	F.initMessageBox(F.aIList,F.aSwitchValue[2]);
	F.initCheckCode();
	F.createJs();
	try{window.parent.fillForm();}catch(e){}
	try{F.initExclude("I113_460,I113_461,I113_462,I114_460,I114_461,I114_462,I115_460,I115_461,I115_462");}catch(e){}
	document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + new Date().getHours();
}

F.initAnswerQuote = function(s){
	var sTemp = "";
	for(var i=0;i<F.aAnswerQuote.length;i++){
		var a = F.aAnswerQuote[i][0].split(",");
		for(var j=0;j<a.length;j++){
			sTemp = $("IBox"+a[j]).getAttribute("AtItemShow");
			$("IBox"+a[j]).setAttribute("AtItemShow","");
			if((sTemp=="")||(sTemp==null)||(sTemp=="undefined")){
				sTemp = F.aAnswerQuote[i][1];
			}
			else{
				sTemp += ","+F.aAnswerQuote[i][1];
			}		
			$("IBox"+a[j]).setAttribute("AtItemShow",sTemp);
			$("IBox"+a[j]).setAttribute("ShowItemName",F.aAnswerQuote[i][2]);
			$("IBox"+a[j]).setAttribute("IsAdd",F.aAnswerQuote[i][3]);
		}
	}
}

F.initMessageBox = function(aIList,iErrMsgMode){
	var div;
	switch(iErrMsgMode){
		case 0:
			break;
		case 1:
			for(var i=0;i<aIList.length;i++){
				div = PublicLib.createTag(null,"div","Message"+aIList[i],"Form_Msg","","");
				if(F.I[aIList[i]][9]){
					F.I[aIList[i]][9].insertBefore(div,F.I[aIList[i]][9].firstChild);
				}
			}
			break;
		case 2:
			div = PublicLib.createTag(document.body,"div","PopMsg","Form_PopMsg","","");
			div.innerHTML = "<div class='Form_PopMsg_Content'></div>";
			break;
	}
}

F.doAction = function(e){
	var t  = typeof(e)=="object"? $EU.getTarget($EU.getEvent(e)) : $(e);
	if(F.aAnswerQuote.length>=1){//引入答案
		
		var IID = F.IDToIID(F.I,t.id);
		if($("IBox"+IID).getAttribute("AtItemShow")==null){
			return;	
		}
		var a = $("IBox"+IID).getAttribute("AtItemShow").toString().split(",");
		if(a[0]==""){
			return;	
		}
		var sValue = F.getItemAnswerResult(IID);
		if($("IBox"+IID).getAttribute("ShowItemName")=="true"){
			sValue = F.I[IID][1] +":"+ sValue;
		}
		for(var i=0;i<a.length;i++){
			if(F.I[a[i]][0]=="14"){
				if(!$("IShow"+a[i]+"_"+IID)){
					PublicLib.createTag($("I"+a[i]),"div","IShow"+a[i]+"_"+IID,"","border:1px solid #eee;padding:5px;margin:5px","");
				}
				$("IShow"+a[i]+"_"+IID).innerHTML = sValue;
			}
			else{
				$("I"+a[i]).value = sValue;
			}
		}
	}
	
	F.doProgress(F.aSwitchValue[4]);
	if(F.aSwitchValue[2]==1){
		var IID = F.IDToIID(F.I,t.id);
		var a = F.checkItem(F.I,IID);
		if(a[0]){
			F.showMsg($("Message"+IID),"not error","none");
		}
		else{
			F.showMsg($("Message"+IID),F.getErrMessage(a,F.Msg,IID),"block");
			if(typeof(a[3])=="undefined"){
				$("I"+a[2]).focus();
			}
			else{
				try{
					$("I"+a[3]).focus();
				}
				catch(e){
					//alert(e+"\n"+a[3]);
				}
			}
		}
	}
	else if(F.aSwitchValue[2]==2){
		var PIID = F.IDToIID(F.I,t.id);
		PIID = F.I[PIID][2]==0?PIID:F.I[PIID][2];
			var a = F.checkItem(F.I,PIID);
			if(a[0]){
				$("PopMsg").style.display = "none";
			}
			else{
				if(typeof(a[3])=="undefined"){
					$("I"+a[2]).focus();
				}
				else{
					try{
					$("I"+a[3]).focus();
					}
					catch(e){
						//题型22在未设置为拖动时会造成此错误，初步原因为创建拖动时是以序号来访问控件的。	
					}
				}
				window.location.hash = "#IBox"+PIID;
				F.openPopMsg($("IBox"+PIID),F.I[PIID][1]+":"+F.getErrMessage(a,F.Msg));
				window.location.hash = "#PopMsg";
			}
	}
}





//初始化响应进度条的控件，radio checkbox使用document委托方式响应，而TEXT SELECT TEXTAREA 需要使用ONCHANGE事件，所以要将ONCHANGE分别绑定到对象
F.initAction = function(){
	var form = $("oqssform");
	for(var i=0;i<form.length;i++){
		if((form[i].type!="RADIO")&&(form[i].tagName!="CHECKBOX")){
			$EU.addHandler(form[i],"change",F.doAction);
		}
	}
}
//执行进度条
F.doProgress = function(showmode){
	if(showmode=="0"){
		return;	
	}
	if(showmode=="1"){
		F.setProgress("P",F.iPageNum,F.iCurrPage,$("ProgressText"),$("ProgressBar"));
	}else{
		F.P[F.iCurrPage][2] = F.checkComplatedInfo(F.I,F.P[F.iCurrPage][0]);
		var a = F.getComplateData(F.P);
		F.setProgress("I",a[0],a[1],$("ProgressText"),$("ProgressBar"));
	}
}

F.getComplateData = function(P){
	var a = [0,0];
	for(var i=1;i<P.length;i++){
		a[0]+= P[i][1];
		a[1]+= P[i][2];
	}
	return a;
}

//由控件的ID找到其题目ID
F.IDToIID = function(I,ID){
	ID = ID.split("_")[0].replace("TableInput","").replace("I","");
	return I[ID][2]==0?ID:I[ID][2];
}
F.addOneTimePSW = function(){
}
F.addMessageArea = function(){
}
F.addMask = function(){
}
F.createProgress = function(iProgressUnit,iMaxValue,iCurrValue){
	if(iProgressUnit==0){return;}
	var div = document.createElement("div");
	document.body.appendChild(div);
	div.innerHTML = '<div style="left:'+(window.document.body.offsetWidth-400)+'px;" id="ProgressBox" class="ProgressBox shadow"><table  border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td width="200"><div class="ProgressBar" id="ProgressBar"></div></td><td width="50" style="font-size:12px;background:#00f;color:#fff;text-align:center" id="ProgressText">'+(iProgressUnit==1?(iCurrValue+"/"+iMaxValue+" 页"):"完成0%")+'</td></tr></table></div>';	
}

F.checkComplatedInfo = function(I,P){
	if(P.length==0){return 0;}
	var aCheck = F.checkPageItem(I,1,P);
	var iComplatedNum = 0;
	for(var i=0;i<aCheck.length;i++){
		iComplatedNum += aCheck[i][0]?1:0;
	}
	return iComplatedNum;
}

F.setProgress = function(sProgressUnit,iMaxValue,iCurrValue,oText,oBar){
	var rule = parseInt(iCurrValue/iMaxValue*100)+"%";
	oText.innerHTML  = sProgressUnit=="P"?(iCurrValue+"/"+iMaxValue+" 页"):rule;
	oBar.style.width = rule;
}

F.checkForm = function(iErrMsgMode,I,aIList){
	var aCheck = F.checkPageItem(I,iErrMsgMode,F.P[F.iCurrPage][0]);
	return F.doMsg(I,aCheck,iErrMsgMode,F.Msg);
}

F.submitForm = function(iErrMsgMode,I,aIList){
	if(F.checkForm(iErrMsgMode,I,aIList)){
		if(F.aSwitchValue[0]=="1"){
			if($("checkcode").value==""){
				F.doCheckCode();
				return false;
			}
		}
		
		if(F.aSwitchValue[5]=="1"){
			F.showSubmitStatus(F.aSwitchValue[6]);
		}
		$("OQSSJSFile").value = "Yes";
		return true;
	}
	else{return false;}
}

F.showSubmitStatus = function(sMessage){
	var div = $("SubmitText");
	if(!div){
		div = PublicLib.createTag(window.document.body,"div","SubmitText","SubmitMessageBox","","");	
	}
	ui.centerObj(div,0,0);
	div.innerHTML = sMessage;
	ui.switchMask("block");
}

F.initCheckCode = function(){
	var div = $("CheckCodeBox");
	if(!div){
		div = PublicLib.createTag($("oqssform"),"div","CheckCodeBox","SubmitMessageBox","","");
		div.innerHTML = "<div style='line-height:normal;margin-top:50px;'><img src='../../img/checkcode.gif' alt='验证码，点击重新获取' style='cursor:pointer' onclick='$getCheckCode(this,\"../../\")' /><br /><br />请输入上面的验证码<br /><input type='text' value='' id='checkcode' name='checkcode' /><input type='button' value='确定' onclick='$(\"CheckCodeBox\").style.display=\"none\"'></div>";
		div.style.display = "none";
		ui.centerObj($("CheckCodeBox"),0,0);
	}
}
F.doCheckCode = function(){
	$("CheckCodeBox").style.display = "block";
	ui.centerObj($("CheckCodeBox"),0,0);
	$("checkcode").focus();
	alert("请输入验证码");
}


F.getErrMessage = function(a,Msg,iIndex){
	var sResult = "";
	if( typeof(a[1][2])!="undefined"){
		sResult = Msg[a[1][0]].replace("$Min",a[1][1]);
		sResult = sResult.replace("$Max",a[1][2]);
	}
	else if( typeof(a[1][1])!="undefined"){
		sResult = Msg[a[1][0]].replace(/(\$Num)|(\$FT)|(\$LimitTotal)/,a[1][1]);
	}
	else{
		sResult= Msg[a[1]];
	}
	return F.I[a[2]][1]+":"+ sResult;
}

//显示消息类型1的消息
F.showMsg = function(o,msg,value){
	if(!o){
		alert("Not MessageBox:"+msg);
		return;	
	}
	var a = ["block","none"];
	o.innerHTML = msg;
	o.style.display = value;
}

F.doMsg = function(I,aCheck,iErrMsgMode,Msg){
	var isResult = true;
	var PIID = 0;
	if((aCheck.length==1)&&(aCheck[0][0])){
		return true;
	}
	switch(iErrMsgMode){
		case 0:
			if(!aCheck[0][0]){
				PIID = I[aCheck[0][2]][2]==0?aCheck[0][2]:I[aCheck[0][2]][2];
				if(typeof(aCheck[0][3])=="undefined"){
					$("I"+aCheck[0][2]).focus();
				}
				else{
					$("I"+aCheck[0][3]).focus();
				}
				isResult = false;
				alert(F.getErrMessage(aCheck[0],Msg));
			}
			break;
		case 1:
			var n =0;
			for(var i=0;i<aCheck.length;i++){
				PIID = I[ aCheck[i][2] ][2]==0?aCheck[i][2]:I[aCheck[i][2]][2];
				if(!aCheck[i][0]){
					F.showMsg($("Message"+PIID),F.getErrMessage(aCheck[i],Msg),"block");
					isResult = false;
					if(n==0){
						window.location.hash = "#Message"+PIID;
					}
					n++;
				}
				else{
					F.showMsg($("Message"+PIID),"not error","none");
				}
			}
			break;
		case 2:
			if(!aCheck[0][0]){
				PIID = I[aCheck[0][2]][2]==0?aCheck[0][2]:I[aCheck[0][2]][2];
				if(typeof(aCheck[0][3])=="undefined"){
					$("I"+aCheck[0][2]).focus();
				}
				else{
					$("I"+aCheck[0][3]).focus();
				}
				isResult = false;
				window.location.hash = "#IBox"+PIID;
				F.openPopMsg($("IBox"+PIID),I[PIID][1]+":"+F.getErrMessage(aCheck[0],Msg));
				window.location.hash = "#PopMsg";
			}
			break;
	}
	return isResult;
}
F.openPopMsg = function(ref,msg){
	if(!ref){
		alert("Not PopMsg:"+msg);
		return;	
	}
	$("PopMsg").style.display = "block";
	var p = ui.getPosi(ref);
	$("PopMsg").style.left = p.left+"px";
	$("PopMsg").style.top = (p.top-111)+"px";
	$("PopMsg").firstChild.innerHTML = msg;
}

F.checkPageItem = function(I,iErrMsgMode,P){
	if(P==""){
		var a = [];
		a[0] = [true,0];	
		return a;
	}
	var s = "";
	var IID = 0;
	var aCheckResult = [];
	if(iErrMsgMode!=1){
		for(var i=0;i<P.length;i++){
			aCheckResult[0] = F.checkItem(I,P[i]);
			if(!aCheckResult[0][0]){
				return aCheckResult;
			}
		}
	}
	else{
		for(var i=0;i<P.length;i++){
			aCheckResult.push(F.checkItem(I,P[i]));
		}		
	}
	return aCheckResult;
}

F.prevPage = function(){
	if((F.iCurrPage==1)||(F.iPageNum==1)){
		return;	
	}
	if(F.sLogic!=""){
		alert("逻辑问卷禁止返回上一页");
		return;	
	}
	$("Page_"+F.iCurrPage).style.display = "none";
	$("Page_"+F.aLoginPath[F.aLoginPath.length-1]).style.display = "block";
	F.clearAnswer(F.iCurrPage);
	F.iCurrPage = F.aLoginPath[F.aLoginPath.length-1];
	F.aLoginPath.pop();
	F.setPageBtStatus(F.iCurrPage,F.iPageNum);
	
}
F.nextPage = function(){
	if((F.iCurrPage==F.iPageNum)||(F.iPageNum==1)){
		alert("NextPage Error")
		return;	
	}
	if(!F.checkForm(F.aSwitchValue[2],F.I,F.aIList)){
		return;	
	}
	F.aLoginPath.push(F.iCurrPage);
	var aLogic = F.doLogic(F.Logic,F.iCurrPage);
	var iLogicAction = 0;//默认动作为下一页
	if(aLogic[0]){
		iLogicAction = 	parseInt(aLogic[1]);
		F.sOverPage = F.addOverPage(F.sOverPage,aLogic[2]);	
	}
	//是否满足条件 aLogic[0]
	//逻辑动作
	//跳过页
	//逻辑顺序
	var iNextPage = F.doLogicAction(iLogicAction,F.sOverPage,F.iCurrPage,F.iPageNum);
	try{
	F.iCurrPage = iNextPage;
	F.setPageBtStatus(iNextPage,F.iPageNum);
	}
	catch(e){
		//ff中会引发此异常
	}
	F.doProgress(F.aSwitchValue[4]);
}


//检查题目是否通过验证
//返回数组[是否通过，验证项，题目IID]
F.checkItem = function(I,iIndex){
	
	var sValue = "";
	var o = $("I"+iIndex);
	var aResult = [true,0];
	//aResult[0] 结果是否通过
	//aResult[1] 检查结果，可能会是个包含检查细节的数组，比如["Empty"] Or ["SelectNum","MaxValue","MinValue"]
	//aResult[2] 被检查题的IID，即索引，如果有子题目，则为子题的IID
	//aResult[3] 当然检查未通过的对象的对象ID值
	
	if($("IBox"+iIndex).style.display=="none"){
		return [true,0,iIndex]
	}
	try{
	var IT = parseInt(I[iIndex][0]);
	}
	catch(e){
		alert("有错误的ID("+iIndex+")\n"+e)	
	}
	var aCheck = I[iIndex][20];
	var iSelectNum = 0;
	var i=0;
	var j=0;
	var og = I[iIndex][5];
	var si = I[iIndex][6];
	

	switch(IT){
		case 1:
		case 3:
			aResult = F.checkTextInput(aCheck,F.$v(o,0),"Empty");
			if(!aResult[0]){
				aResult[2] = iIndex;
				return aResult;
			}
			break;
		case 2:
		case 25:
			sValue = F.$v(o,0).toString();
			if((aCheck["Empty"]=="1")&&(sValue=="")){
				return [false,["Empty"],iIndex];
			}
			if(sValue!=""){
				if(IT==2){
					if(!OQSSRegExp.Int.test(sValue)){
						return [false,["Int"],iIndex];
					}
				}
				else{
					if(!OQSSRegExp.Real.test(sValue)){
						return [false,["Real"],iIndex];
					}

				}
				if(aCheck["LimitValue"]=="1"){
					if(parseFloat(sValue)> parseFloat(aCheck["MaxValue"])){
						return [false,["LimitValue",aCheck["MinValue"],aCheck["MaxValue"]],iIndex];
					}
					if(parseFloat(sValue)< parseFloat(aCheck["MinValue"])){
						return [false,["LimitValue",aCheck["MinValue"],aCheck["MaxValue"]],iIndex];
					}
				}
			}			
			break;
		case 4:
		case 5:
		case 6:
		case 11:
		case 26:
			if(IT!=6){
				sValue = F.$v($n("I"+iIndex),1);
			}
			else{
				sValue = F.$v(o,2);
			}
			if(aCheck["Empty"]=="1"){
				if(sValue==""){
					return [false,["Select"],iIndex, IT!=6?( iIndex+"_"+og[0]):undefined];
				}
			}
			
			if((IT==5)&&(aCheck["Input"]=="1")){
				aResult = F.checkTextInput(aCheck,$("I"+iIndex+"_Input").value,"Input");
				if(!aResult[0]){
					aResult[2] = iIndex;
					aResult[3] = iIndex+"_Input";
					return aResult;
				}	
			}
			if((IT==26)&&(aCheck["Input"]=="1")){
				for(j=0;j<og.length;j++){
					aResult = F.checkTextInput(aCheck,$("I"+iIndex+"_"+og[j]+"_Input").value,"Input");
					if(!aResult[0]){
						aResult[2] = iIndex;
						aResult[3] = iIndex+"_Input";
						return aResult;
					}
				}
			}
			break;
		case 8:
		case 9:
		case 10:
		case 27:
			if(aCheck["Empty"]=="1"){
				if(IT!=10){
					sValue = F.$v($n("I"+iIndex),1);
					if(sValue==""){					
						return [false,["Select"],iIndex,iIndex+"_"+og[0]];
					}
				}
				else{
					sValue = F.$v(o,2);	
					if(sValue==""){					
						return [false,["Select"],iIndex];
					}
				}				
			}
			
			if(aCheck["SelectNum"]=="1"){
				iSelectNum = sValue==""?0:sValue.split(",").length;
				if(parseInt(aCheck["MaxSelect"])<iSelectNum){
					return [false,["SelectNum",aCheck["MinSelect"],aCheck["MaxSelect"]],iIndex,IT!=10?iIndex+"_"+og[0]:iIndex];
					
				}
				if(parseInt(aCheck["MinSelect"])>iSelectNum){
					return [false,["SelectNum",aCheck["MinSelect"],aCheck["MaxSelect"]],iIndex,IT!=10?iIndex+"_"+og[0]:iIndex];
				}
			}
			
			if((IT==9)&&(aCheck["Input"]=="1")){
				aResult = F.checkTextInput(aCheck,$("I"+iIndex+"_Input").value,"Input");
				if(!aResult[0]){
					aResult[2] = iIndex;
					aResult[3] = iIndex+"_Input";
					return aResult;
				}	
			}	
			if((IT==27)&&(aCheck["Input"]=="1")){
				for(j=0;j<og.length;j++){
					aResult = F.checkTextInput(aCheck,$("I"+iIndex+"_"+og[j]+"_Input").value,"Input");
					if(!aResult[0]){
						aResult[2] = iIndex;
						aResult[3] = iIndex+"_Input";
						return aResult;
					}
				}
			}
			break;
		case 12:
			if((aCheck["Empty"]=="1")&&($("I"+iIndex+"_Result").value=="")){
				return [false,["Empty"],iIndex];
			}
			break;
		case 13:
			sValue = F.$v($n("I"+iIndex),3);
			if(aCheck["Empty"]=="1"){
				if(sValue==""){
					return [false,["Empty"],iIndex,iIndex+"_0"];
				}
			}
			if(sValue!=""){
				var at = sValue.split("\n");
				//aCheck["MinList"] = 2;
				if(at.length<parseInt(aCheck["MinList"])){
					return [false,["ListInput",aCheck["MinList"]],iIndex,iIndex+"_0"]
				}
				for(  i=0;i<at.length;i++){
					aResult = F.checkTextInput(aCheck,at[i],"NotEveryOne");
					if(!aResult[0]){
						aResult[2] = iIndex;
						aResult[3] = iIndex+"_0";
						return aResult;
					}
				}
			}
			break;
		case 7:
		case 19:
			if(aCheck["Empty"]=="1"){
				for(  i=0;i<si.length;i++){
					if(F.$v($n("I"+si[i]),1)==""){
						return [false,["Empty"],si[i],si[i]+"_"+og[0]];	
					}
				}
			}
			if(IT==19){
				for(  i=0;i<si.length;i++){
					aResult = F.checkTextInput(aCheck,F.$v($("I"+si[i]+"_Input"),0),"Input");
					if(!aResult[0]){
						aResult[2] = si[i];
						aResult[3] = si[i]+"_Input";
						return aResult;
					}
				}
			}
			break;
		case 15:
		case 20:
			if(aCheck["Empty"]=="1"){
				for(  i=0;i<si.length;i++){
					if(F.$v($n("I"+si[i]),1)==""){
						return [false,["Empty"],si[i],si[i]+"_"+og[0]];	
					}
				}
			}
			if(aCheck["SelectNum"]=="1"){
				for(  i=0;i<si.length;i++){
					iSelectNum = F.$v($n("I"+si[i]),1).split(",").length;
					if(parseInt(aCheck["MaxSelect"])<iSelectNum){
						return [false,["SelectNum",aCheck["MinSelect"],aCheck["MaxSelect"]],si[i],si[i]+"_"+og[0]];
					}
					if(parseInt(aCheck["MinSelect"])>iSelectNum){
						return [false,["SelectNum",aCheck["MinSelect"],aCheck["MaxSelect"]],si[i],si[i]+"_"+og[0]];
					}
				}
			}
			if ( (IT==20)&& (aCheck["Input"]=="1") ){
				for(  i=0;i<si.length;i++){
					aResult = F.checkTextInput(aCheck,F.$v($("I"+si[i]+"_Input"),0),"Input");
					if(!aResult[0]){
						aResult[2] = si[i];
						aResult[3] = si[i]+"_Input";
						return aResult;
					}
				}
			}
			break;
		case 16:
			for(i=0;i<si.length;i++){
				for(j=0;j<og.length;j++){
					aResult = F.checkTextInput(aCheck,$("I"+si[i]+"_"+og[j]).value,"Empty");
					if(!aResult[0]){
						aResult[2] = si[i];
						aResult[3] = si[i]+"_"+og[j];
						return aResult;
					}
				}
			}
			break;
		case 17:
			sValue = $("I"+iIndex).value.toLowerCase();

			if(aCheck["Empty"]=="1"){
				if(sValue==""){
					return [false,["Empty"],iIndex];	
				}
			}
			sValue = sValue.substring(sValue.lastIndexOf("."))+".";
						
			if(aCheck["White"]=="1"){
				if(("."+aCheck["FT"]+".").indexOf(sValue)<0){
					return [false,["FT",aCheck["FT"]],iIndex];
				}
			}
			if(aCheck["Black"]=="1"){
				if(("."+aCheck["FT"]+".").indexOf(sValue)>=0){
					return [false,["FT",aCheck["FT"]],iIndex];
				}
			}
			
			break;
		
		case 21:
			var iTotal = 0;
			for(i=0;i<si.length;i++){
				sValue = $("I"+si[i]).value;
				if(aCheck["Empty"]=="1"){
					if(sValue==""){
						return [false,["Empty"],si[i]];
					}
				}
				if(sValue!=""){
					if(!OQSSRegExp.Int.test(sValue)){
						return [false,["Int"],si[i]];
					}
					iTotal += parseInt(sValue);
				}
			}
			if(aCheck["LimitTotal"]=="1"){
				if(iTotal!= parseInt(aCheck["PercentTotal"])){
					return [false,["LimitTotal",aCheck["PercentTotal"]],si[0]];	
				}
			}
			break;
		case 22:
			for(i=0;i<si.length;i++){
				sValue = F.$v($n("I"+si[i]),1);
				if(aCheck["Empty"]=="1"){
					if(sValue==""){
						return [false,["Empty"],si[i],si[i]+"_"+og[0]];
					}
				}	
			}
			break;
		case 23:
			var iRowNum = parseInt($("TableInput"+iIndex).getAttribute("DefaultRow"))+1;
			
			for(i=0;i<og.length;i++){
				for(j=0;j<iRowNum;j++){
					try{
					aResult = F.checkTextInput(aCheck,$("I"+iIndex+"_"+og[i]+"_"+j).value,"Empty");
					}
					catch(e){
						alert("I"+iIndex+"_"+og[i]+"_"+j+"\n"+e+"\nog:"+og[i]);
					}
					if(!aResult[0]){
						aResult[2] = iIndex;
						aResult[3] = iIndex+"_"+og[i]+"_"+j;
						return aResult;
					}
				}
			}
			break;
		case 18:
			var sog = I[iIndex][7].toString().split(",");
			var o = null;
			if(aCheck["Empty"]=="1"){
				for(i=0;i<si.length;i++){
					for(j=0;j<sog.length;j++){
						o =  $("I"+si[i]+"_"+sog[j]);
						if(o.selectedIndex<=0){							
							return [false,["Empty"],si[i],si[i]+"_"+sog[j]];
						}
					}
				}
			}
			break;
		case 24:
			var sog = I[iIndex][7];
			if(aCheck["Empty"]=="1"){
				for(i=0;i<si.length;i++){
					for(j=0;j<sog.length;j++){
						sValue = F.$v( $n("I"+si[i]+"_"+sog[j]),1);
						if(sValue==""){
							return [false,["Empty"],si[i],si[i]+"_"+sog[j]+"_"+og[0]];
						}
					}
				}
			}
			break;
		
	}
	return [true,0,iIndex]
}


F.checkTextInput = function(a,v,TopCondition){
	if(a[TopCondition]=="1"){
		if(v==""){
			return [false,[TopCondition]];
		}
	}
	if(v!=""){
		if(a["Email"]=="1"){
			if(!OQSSRegExp.Email.test(v)){
				return [false,["Email"]];
			}
		}
		else if(a["Mob"]=="1"){
			if(!OQSSRegExp.Mob.test(v)){
				return [false,["Mob"]];
			}
		}
		else if(a["IDCard"]=="1"){
			if(!OQSSRegExp.IDCard.test(v)){
				return [false,["IDCard"]];
			}
		}
		else if(a["Date"]=="1"){
			if(!OQSSRegExp.Date.test(v)){
				return [false,["Date"]];
			}
		}
		else if(a["Cn"]=="1"){
			if(OQSSRegExp.Cn.test(v)){
				return [false,["Cn"]];
			}
		}
		else if(a["En"]=="1"){
			if(!OQSSRegExp.En.test(v)){
				return [false,["En"]];
			}
		}
		else if(a["Post"]=="1"){
			if(!OQSSRegExp.Post.test(v)){
				return [false,["Post"]];
			}
		}
		if(a["MaxLen"]!=""){
			if(v.length>parseInt(a["MaxLen"])){
				return [false,["Len",a["MinLen"],a["MaxLen"]]];
			}
		}
		if(a["MinLen"]!=""){
			if(v.length<parseInt(a["MinLen"])){
				return [false,["Len",a["MinLen"],a["MaxLen"]]];
			}
		}
		
	}
	return [true,0];
}

F.getCheck = function(sInput){
	//var aResult = ["Cn","En","Email","Date","Post","IDCard","Len","LimitValue","SelectNum","Input","Mob","Empty","MaxLen","MinLen","MaxValue","MinValue","MaxSelect","MinSelect","MaxList","MinList","WBL","FT","FS"];
	var aResult = [];
	var aInput = sInput.split(",");
	for(var i=0;i<aInput.length;i++){
		aResult[aInput[i].split(":")[0]] = aInput[i].split(":")[1];
	}
	//alert("aResult:"+aResult+"\nsInput:"+sInput+"\naInput:"+aInput.length)
	return aResult;
}

F.initItemArr = function(aIList,I,iPageNum,P){
	var i =0;
	var j =0;
	for(i=1;i<=iPageNum;i++){
		P[i] = [];
		P[i][0] = []; //Item Arr
		P[i][1] = 0;//Item Num
		P[i][2] = 0;//Complated Num
	}
	for(i=0;i<aIList.length;i++){
		I[aIList[i]][0] = parseInt(I[aIList[i]][0]);
		if(",4,5,6,7,8,9,10,11,12,15,16,19,20,23,24,26,27,".indexOf(","+I[aIList[i]][0]+",")>=0){
			I[aIList[i]][5] = I[aIList[i]][5].toString().split(",");
			if( I[aIList[i]][0]=="12" ){
				F.initSortBt(aIList[i]);	
			}
			if( I[aIList[i]][0]=="23" ){
				F.initTableInputBt(aIList[i],I);
			}
		}
		if(",7,15,16,18,19,20,21,22,24,".indexOf(","+I[aIList[i]][0]+",")>=0){
			I[aIList[i]][6] = I[aIList[i]][6].toString().split(",");
			
		}
		if(",18,24,".indexOf(","+I[aIList[i]][0]+",")>=0){
			I[aIList[i]][7] = I[aIList[i]][7].split(",");
		}
		
		I[aIList[i]][20] = F.getCheck(I[aIList[i]][4]);
		if(I[aIList[i]][2]==0){
			P[I[aIList[i]][3]][0].push(aIList[i]);
			P[I[aIList[i]][3]][1]++;
		}
		F.setSelectAndInputAttribute(aIList[i],I);
	}
	return [I,P];
}

F.initImgBt = function(aIList,I){
	var j=0;
	var n=0;
	var o = null;
	for(var i=0;i<aIList.length;i++){
		switch(I[aIList[i]][8]){
			case "":
				break;
			case "Adjust":
				var ai = I[aIList[i]][6];
				var ao = I[aIList[i]][5];
				var ss = new F.SlipSelect();
				if(I[aIList[i]][0]==11){
					ss.createDrag($("AdjustPoint"+aIList[i]),$("AdjustBar"+aIList[i]),"PublicLib.autoSelectRadio('I"+aIList[i]+"',vvv)",ao.length);
				}
				else{
					for(n=0;n<ai.length;n++){
						ss.createDrag($("AdjustPoint"+ai[n]),$("AdjustBar"+ai[n]),"PublicLib.autoSelectRadio('I"+ai[n]+"',vvv)",I[aIList[i]][5].split(",").length);
					}
				}
				break;
			default :
				var ai = I[aIList[i]][6];
				var ao = I[aIList[i]][5];
				var b = I[aIList[i]][8].replace("_normal","");
				b = b+"_normal,"+b+"_over,"+b+"_out,"+b+"_down,"+b+"_up";
				if(",4,5,8,9,11,".indexOf(","+I[aIList[i]][0]+",")>=0)
					for(j=0;j<ao.length;j++){
						o = $("I"+aIList[i]+"_"+ao[j]+"_");
						o.setAttribute("check","false");
						ui.GoodBt(o,b.split(","),"over|1|out|1|down|1|up|1|click|1".split("|"));
						$EU.addHandler(o,"click",F.doImgBt);
					}
				else{
					//7,19,15,20,22
					for(n=0;n<ai.length;n++){
						for(j=0;j<ao.length;j++){
							o = $("I"+ai[n]+"_"+ao[j]+"_");
							o.setAttribute("check","false");
							ui.GoodBt(o,b.split(","),"over|1|out|1|down|1|up|1|click|1".split("|"));
							$EU.addHandler(o,"click",F.doImgBt);
						}
					}
				}
				break;
			
		}
	}
}

F.initSortBt = function(IID){$EU.addHandler($("I"+IID+"_UpMoveBt"),"click",F.moveOption);$EU.addHandler($("I"+IID+"_DownMoveBt"),"click",F.moveOption);}

F.setSelectAndInputAttribute = function(IID,I){
	var sTemp = "";
	var i=0;
	var j =0;
	var SIID = 0;
	switch(I[IID][0]){
		case 26:
			for(i=0;i<I[IID][5].length;i++){
				sTemp += "I"+IID+"_Input_"+I[IID][5][i]+",";
			}
			for(i=0;i<I[IID][5].length;i++){
				$("I"+IID+"_"+I[IID][5][i]).setAttribute("DisabledValue",sTemp._delLastChar()+":I"+IID+"_Input_"+I[IID][5][i]);
			}
			break;
		case 5:
			for(i=0;i<I[IID][5].length-1;i++){
				$("I"+IID+"_"+I[IID][5][i]).setAttribute("DisabledValue","I"+IID+"_Input"+":");
			}
			$("I"+IID+"_"+I[IID][5][i]).setAttribute("DisabledValue",":I"+IID+"_Input");
			$("I"+IID+"_Input").disabled = !$("I"+IID+"_"+I[IID][5][i]).checked;
			break;
		case 9:
			$("I"+IID+"_"+I[IID][5][I[IID][5].length-1]).setAttribute("DisabledValue",":I"+IID+"_Input");
			$("I"+IID+"_Input").disabled = !$("I"+IID+"_"+I[IID][5][I[IID][5].length-1]).checked;
			break;
		case 27:
			for(i=0;i<I[IID][5].length;i++){
				$("I"+IID+"_"+I[IID][5][i]).setAttribute("DisabledValue",":I"+IID+"_Input_"+I[IID][5][i]);
			}
			break;
		case 19:
			for(i=0;i<I[IID][6].length;i++){
				SIID = I[IID][6][i];
				for(j=0;j<I[IID][5].length-1;j++){
					$("I"+SIID+"_"+I[IID][5][j]).setAttribute("DisabledValue","I"+SIID+"_Input"+":");
				}
				$("I"+SIID+"_"+I[IID][5][j]).setAttribute("DisabledValue",":I"+SIID+"_Input");
				$("I"+SIID+"_Input").disabled = !$("I"+SIID+"_"+I[IID][5][j]).checked;
			}
			break;
		case 20:
			for(i=0;i<I[IID][6].length;i++){
				SIID = I[IID][6][i];
				$("I"+SIID+"_"+I[IID][5][I[IID][5].length-1]).setAttribute("DisabledValue",":I"+SIID+"_Input");
				$("I"+SIID+"_Input").disabled = !$("I"+SIID+"_"+I[IID][5][I[IID][5].length-1]).checked;
			}
			break;
	}
}


F.doDisabled = function(v,checked){
	if((v=="")||(typeof(v)!="string")||(v==null)){
		return;
	}
	var a = v.split(":")[0].split(",");
	var b = v.split(":")[1].split(",");
	for(var i=0;i<a.length;i++){
		if(a[i]!=""){
		$(a[i]).disabled = true;		
		}
	}
	for(var i=0;i<b.length;i++){
		if(b[i]!=""){
		$(b[i]).disabled = !checked;
		}		
	}
}


F.moveOption = function(e){
	var IID,d;
	e = $EU.getEvent(e);
	var sBtName = $EU.getTarget(e).id;
	if(sBtName.indexOf("UpMoveBt")>0){
		d = 0;
		IID = sBtName.replace("_UpMoveBt","").replace("I","");
	}
	else{
		d = 1;
		IID = sBtName.replace("_DownMoveBt","").replace("I","");
	}
	var o = $("I"+IID)
	var iSelected = o.selectedIndex;
	var value = "";
	var text = "";
	var a=[];
	if(iSelected==-1){
		return;	
	}
	if(d==0){
		if(iSelected==0){
			return;	
		}
		value = o.options[iSelected].value;
		text = o.options[iSelected].text;
		o.options[iSelected].value = o.options[iSelected-1].value;
		o.options[iSelected].text = o.options[iSelected-1].text;
		o.options[iSelected-1].value = value;
		o.options[iSelected-1].text = text;
		o.selectedIndex = iSelected-1;
		
	}
	else{
		if(iSelected>=(o.options.length-1)){
			return;	
		}	
		value = o.options[iSelected].value;
		text = o.options[iSelected].text;
		o.options[iSelected].value = o.options[iSelected+1].value;
		o.options[iSelected].text = o.options[iSelected+1].text;
		o.options[iSelected+1].value = value;
		o.options[iSelected+1].text = text;
		o.selectedIndex = iSelected+1;
	}
	for(var i=0;i<o.length;i++){
		a.push(o[i].value+":"+(i+1));	
	}
	$("I"+IID+"_Result").value = ","+a.join(",")+",";
}

F.initTableInputBt = function(IID,I){
	var iCurrRow = $n("I"+IID).length/I[IID][5].length-1;
	$("TableInput"+IID).setAttribute("DefaultRow",iCurrRow);
	$("TableInput"+IID+"_0").disabled = true;
	$EU.addHandler($("TableInput"+IID+"_0"),"click",F.changeTableRow);
	$EU.addHandler($("TableInput"+IID+"_1"),"click",F.changeTableRow);
	
}


F.changeTableRow_Add = function(IID){
	var iCurrRow = parseInt($("TableInput"+IID).getAttribute("DefaultRow"));
	var ao = F.I[IID][5];
	var obj = null;
	for(i=0;i<ao.length;i++){
		obj = document.createElement("INPUT");
		obj.className = "TableInput";
		obj.name = "I"+IID;
		obj.id = "I"+IID+"_"+ao[i]+"_"+(iCurrRow+1);
		$("I"+IID+"_"+ao[i]+"_"+iCurrRow).parentNode.appendChild(obj);
		obj = document.createElement("br");
		$("I"+IID+"_"+ao[i]+"_"+iCurrRow).parentNode.appendChild(obj);
	}
	$("TableInput"+IID).setAttribute("DefaultRow",iCurrRow+1);
	$("TableInput"+IID+"_0").disabled = false;
}
F.changeTableRow_Sub = function(IID){
	var iCurrRow = parseInt($("TableInput"+IID).getAttribute("DefaultRow"));
	var ao = F.I[IID][5];
	if(iCurrRow==0){
		return;	
	}
	$("TableInput"+IID+"_0").disabled = false;
	for(i=0;i<ao.length;i++){
		$("I"+IID+"_"+ao[i]+"_"+iCurrRow).parentNode.removeChild($("I"+IID+"_"+ao[i]+"_"+iCurrRow).nextSibling);
		$("I"+IID+"_"+ao[i]+"_"+iCurrRow).parentNode.removeChild($("I"+IID+"_"+ao[i]+"_"+iCurrRow));
	}
	$("TableInput"+IID).setAttribute("DefaultRow",iCurrRow-1);
	$("TableInput"+IID+"_0").disabled =	iCurrRow==1?true:false;
}
F.changeTableRow = function(e){
	var oBt =(typeof(e)=="object")?$EU.getTarget($EU.getEvent(e)):$(e);
	var d = oBt.id.split("_")[1];
	var IID = oBt.id.split("_")[0].replace("TableInput","");
	d=="0"?F.changeTableRow_Sub(IID):F.changeTableRow_Add(IID);
}

F.doImgBt = function(e){
	var o = $EU.getTarget($EU.getEvent(e));
	var IID = o.id.substring(1,o.id.indexOf("_"));
	if($n("I"+IID)[0].getAttribute("type")=="radio"){
		F.RadioImgBt(o,IID);
	}
	else{
		F.CheckBoxImgBt(o,IID);
	}
}

F.RadioImgBt = function(o,IID){
	var sClassName = o.className.substring(0,o.className.indexOf("_"));
	var sValue = F.$v($n("I"+IID),1);
	if(sValue!=""){
		var t = null;
		t = $("I"+IID+"_"+sValue+"_");
		t.className = sClassName+"_normal";
		t.setAttribute("over","1");
		t.setAttribute("out","1");
		t.setAttribute("down","1");
		t.setAttribute("up","1");		
	}
	o.setAttribute("over","0");
	o.setAttribute("out","0");
	o.setAttribute("down","0");
	o.setAttribute("up","0");
	o.className = sClassName+"_down";
}

F.CheckBoxImgBt = function(o,IID){
	var sClassName = o.className.substring(0,o.className.indexOf("_"));
	var status = "0";
	var styleStatus = "";
	var check = "";
	var t = null;
		if(o.getAttribute("check")=="false"){
			status = "0";
			styleStatus = "_down";
			check = "true";
		}
		else{
			status = "1";
			styleStatus = "_normal";	
			check = "false";
		}
		
		o.className = sClassName+styleStatus;
		o.setAttribute("over",status);
		o.setAttribute("out",status);
		o.setAttribute("down",status);
		o.setAttribute("up",status);		
		o.setAttribute("check",check);	
}

F.clearFill = function(I,IID){
	var IT = I[IID][0];
	var og = I[IID][5];
	var si = I[IID][6];
	var sog = I[IID][7];
	switch(IT){
		case 1:case 2:case 3:case 25:
			$("I"+IID).value = "";
			break;
		case 4:
			break;
		case 5:
			break;
	}
}
F.clearSelect = function(o){
}

F.testCheck = function(){
	alert($("I10_6").checked)	
}

F.initLogic = function(sLogic,iPageNum){
	var P = new Array(iPageNum);
	if(sLogic==""){
		return P;	
	}
	var A = sLogic.split("#");//以#分隔多个逻辑发生页
	var i=0;
	var j=0;
	for(i=0;i<P.length;i++){
		P[i] = "";
	}

	var sTemp = "";
	var aTemp = [];
	for(i=1;i<P.length;i++){
		for(j=0;j<A.length;j++){
			if(A[j].indexOf(i+":")==0){
				P[i] =  A[j].substring(A[j].indexOf(":")+1).split(";");	
			}
		}
	}
	return P;
}

F.doLogic = function(P,iPageNo){
	//P[n] 去除了页号的第n页的逻辑器
	//P[n] 是某页以;分隔了的多个逻辑的数组
	var n = iPageNo;
	if((P[n]=="")||(typeof(P[n])=="undefined")){
		//alert("返回")
		return "";	
	}
	
	var aLogicList = new Array(P[n].length);//一个与P[n]等长的数组，用于存放计算逻辑后的结果1维是否满足条件，2维，逻辑顺序
	var i=0;
	var j =0;
	var IID = 0;
	var ac = []; //arr condition
	var ap = [];//arr par
	var sSingleLogic = "";
	var sValue = "";
	var at = [];
	/*
PageLogic
	Page1:Logic0;Logic1;Logicn#Page2:Logic0;Logic1;Logicn
SingleLogic
	Condition0.Condition1.Conditionn>Action:OverPage:MultiConditionRelation:LogicIndex
Condtion
	IID:Value:CondtionRelation
	
F.sLogic='1:3:1:0>3:2:0:';


var s="1:6:5:0>3:2:0:;6:6:0>2:3,4,5:0:";*/
//	var s="1:6:5:0>3:2:0:;6:6:0>2:3,4,5:0:";
	var ar = [];//条件计算结果
	
	//遍历一个逻辑发生页中的所有逻辑
	for(i=0;i<P[n].length;i++){
		ar = [];
		sSingleLogic = P[n][i];
		ac = sSingleLogic.substring(0,sSingleLogic.indexOf(">")).split(".");//存放条件的数组 如上面的6:5:0
		ap = sSingleLogic.substring(sSingleLogic.indexOf(">")+1).split(":");//存放单一逻辑的动作参数 3:2:0: 
		for(j=0;j<ac.length;j++){//遍历条件是否满足，存放于ar中
			at = ac[j].split(":");//at[0] IID ; at[1] 设置的题目值 ;at[2] 比较关系 0等于 1不等于
			if(",4,6,11,".indexOf(","+F.I[at[0]][0]+",")>=0){
				sValue = F.$v($n("I"+at[0]),1);
			}
			else if(",8,9,".indexOf(","+F.I[at[0]][0]+",")>=0){
				sValue = F.$v($n("I"+at[0]),3);
			}
			else{
				sValue = F.$v($n("I"+at[0]),2);
			}
			if(at[2]=="0"){//等于关系
				ar.push(at[1]==sValue);
			}
			else{
				ar.push(at[1]!=sValue);
			}
		}
		var blnTemp = null;
		
		if(ap[2]=="0"){
			//如果多个条件间的关系为并且，要要在ar中找到所有关系都为真，才为真
			blnTemp = true;
			for(j=0;j<ar.length;j++){
				if(!ar[j]){
					blnTemp = false;
					break;
				}
			}
		}
		else{
			//如果多个条件间的关系为或者，只要在ar中找到任何一个关系为真即可
			blnTemp = false;
			for(j=0;j<ar.length;j++){
				if(ar[j]){
					blnTemp = true;
					break;
				}
			}
		}
		aLogicList[i] = [];
		aLogicList[i][0] = blnTemp;//是否满足条件
		aLogicList[i][1] = ap[0];//逻辑动作
		aLogicList[i][2] = ap[1];//跳过页
		aLogicList[i][3] = ap[3]==""?1:parseInt(ap[3]);//逻辑顺序
	}
	var iMinIndex = 0;
	var iTemp = 10000;
	
	//遍历已经计算了的逻辑，寻找为真的逻辑，并找其最小值（即逻辑顺序中设定的）来返回
	for(i=0;i<aLogicList.length;i++){
		if(aLogicList[i][0]){
			if(iTemp > parseInt(aLogicList[i][3])){
				iTemp = parseInt(aLogicList[i][3]);
				iMinIndex = i;
			}
		}
	}
	if(iTemp==0){//未找到逻辑
		return "";
	}
	else{
		return aLogicList[iMinIndex];
	}
}


F.addOverPage = function(sInput,sValue){
	var a = sValue.split(",");
	var b = sInput==""?[]: sInput.split(",");
	sInput = ","+sInput+",";
	for(var i=0;i<a.length;i++){
		if( sInput.indexOf(","+a[i]+",")<0){
			sInput += a[i]+",";
			b.push(a[i]);
		}
	}
	return b.join(",");
}

F.subOverPage = function(sInput,sValue){
	var a = sValue.split(",");
	for(var i=0;i<a.length;i++){
		if( (","+sInput+",").indexOf(","+sValue+",")>=0){
			sInput = (","+sInput+",").replace(","+sValue+",");
		}
	}
	return sInput;
}

F.doLogicAction = function(iAction,sOverPage,iCurrPage,iMaxPage){
	var iNextPage = 0;
	if(sOverPage!=""){
		var a = sOverPage.split(",");
		for(var i=0;i<a.length;i++){
			$("Page_"+a[i]).style.display = "none";
		}
	}
	switch(iAction){
		case 0://默人下一页
			iNextPage = F.foundNextPage(sOverPage,iCurrPage,iMaxPage);
			
			$("Page_"+iCurrPage).style.display = "none";
			$("Page_"+iNextPage).style.display = "block";			
			break;
		case -1://终止
			top.location.href= "complete.htm";
			break;
		case -2://提交
			$("oqssform").submit();
			break;
		case -3://重新

			top.location.href = document.location.href;
			break;
		default :
			$("Page_"+iCurrPage).style.display = "none";
			$("Page_"+iAction).style.display = "block";
			iNextPage = iAction;
			break;
	}
	return iNextPage;
}

F.foundNextPage = function(sOverPage,iCurrPage,iMaxPage){
	var iResult = 0;
	for(var i=(iCurrPage+1);i<=iMaxPage;i++){
		if( (","+sOverPage+",").indexOf(","+i+",")<0){
			iResult = i;
			break;
		}
	}
	return iResult;
}

F.foundPreviousPage = function(sLogicPath){
	var a = sLogicPath.split(",");
	return parseInt(a[a.length-1]);	
}

F.setPageBtStatus = function(iTargetPage,iMaxPage){
	$("SubmitBt").disabled = iTargetPage>=iMaxPage?"":"disabled";
	$("NextBt").disabled = iTargetPage==iMaxPage?"disabled":"";
	$("PreviousBt").disabled = iTargetPage==1?"disabled":"";
}

F.unFillPageItem = function(iPageNo){
	var I = F.P[iPageNo].split(",");
	for(var i=0;i<I.length-1;i++){
		F.unFillItem(I[i]);
	}
}

F.unFillItem = function(IID){
	var IT = F.I[IID][0];
	var o = $("I"+IID);
	var on = $n("I"+IID);
	var i;
	var j;
	switch(IT){
		case 1:
		case 2:
		case 3:
		case 17:
		case 25:
			o.value = "";
			break;
		case 4:
		case 8:
		case 5:
		case 9:
		case 11:
			for(i=0;i<on.length;i++){
				on[i].checked = false;
			}
			if((IT==5)||(IT==9)){
				$("I"+IID+"_Input").value = "";
			}
			break;
		case 6:
			o.selectedIndex = 0;
			break;
		case 10:
			for(i=0;i<o.length;i++){
				o[i].selected = false;
			}
			break;
		case 12:
			$("I"+IID+"_Result").value = "";
			break;
		case 13:
			for(i=0;i<on.length;i++){
				on[i].value = "";
			}
			break;
		case 7:
		case 15:
		case 19:
		case 20:
		case 22:
			var si = F.I[IID][6].split(",");
			for(i=0;i<si.length;i++){
				on = $n("I"+si[i]);
				for(j=0;j<on.length;j++){
					on[j].checked = false;
				}
			}
			if((IT==19)||(IT==20)){
				for(i=0;i<si.length;i++){
					$("I"+si[i]+"_Input").value = "";
				}
			}
			break;
		case 16:
			var og = F.I[IID][5].split(",");
			var si = F.I[IID][6].split(",");
			for(i=0;i<si.length;i++){

				for(j=0;j<og.length;j++){
					$("I"+si[i]+"_"+og[j]).value = "";
				}
			}
			break;
		case 18:
			var sog = I[IID][7].toString().split(",");
			var si = F.I[IID][6].split(",");
			for(i=0;i<si.length;i++){
				for(j=0;j<sog.length;j++){
					o =  $("I"+si[i]+"_"+sog[j]);
					o.selectedIndex = 0;
				}
			}
			break;
		case 21:
			var si = F.I[IID][6].split(",");
			for(i=0;i<si.length;i++){
				$("I"+si[i]).value = "";
			}
			break;
		case 23:
			var iCurrRow = parseInt($("TableInput"+IID).getAttribute("DefaultRow"));
			var ao = F.I[IID][5];
			$("TableInput"+IID+"_0").disabled = true;
			for(i=0;i<ao.length;i++){
				$("I"+IID+"_"+ao[i]+"_0").value = "";
			}
			for(i=0;i<iCurrRow;i++){
				F.changeTableRow_Sub(IID);
			}
			break;
		case 24:
			var sog = I[iIndex][7];			
				for(i=0;i<si.length;i++){
					for(j=0;j<sog.length;j++){
						o = $n("I"+si[i]+"_"+sog[j]);
						for(var n=0;n>o.length;n++){
							o[n].checked = false;
						}
						
					}
				}
			break;
		
	}
}


F.initItemLogic = function(sInput){
	if(sInput==""){return;}
	var b = sInput.split("|")[0];
	var a = sInput.split("|")[1];
	var i,j = 0;
	var aItem,aOption,aTemp = [];
	if(b!=""){
		b=b.split(",");
		for(i=0;i<b.length;i++){
			F.I[b[i]][9].style.display = "none";
		}
	}
	F.autoHiddenItem = b.join(",");
	if(a!=""){
		var IID = 0;
		a = a.split(";");
		for(i=0;i<a.length;i++){
			IID = a[i].substr(0,a[i].indexOf(":"));
			aOption = a[i].substr(a[i].indexOf(":")+1).split("-");
			for(j=0;j<aOption.length;j++){
				aTemp = aOption[j].split(".");
				var o = $("I"+IID+"_"+aTemp[0]);
				o.setAttribute("S",aTemp[1]);
				o.setAttribute("H",aTemp[2]);
				$EU.addHandler(o,"click",F.doItemLogic);
			}
		}
	}
}
F.doItemLogic = function(e){
	var t = typeof(e)=="object"? $EU.getTarget($EU.getEvent(e)):$(e);
	if(!t.checked){return;}
	F.clearItemLogicResult(t);
	return;
}

F.clearItemLogicResult = function(o){
	var h = o.getAttribute("H");//需要隐藏的题目
	var s = o.getAttribute("S");//需要显示的题目 
	var nl = null;
	var j = 0;
	var hs;//被隐藏题目显示的题目
	if((h!=null)&&(h!="")){
		h = h.split(",");
		for(var i=0;i<h.length;i++){
			$("IBox"+h[i]).style.display = "none";
			F.unFillItem(h[i]);
			if( (",4,5,26,").indexOf(","+F.I[h[i]][0]+",")>=0 ){
				nl = $n("I"+h[i]);
				for(j=0;j<nl.length;j++){
					hs = nl[j].getAttribute("S");
					if((hs!="")&&(hs!=null)){
						hs = hs.split(",");
						for(var n=0;n<hs.length;n++){
							$("IBox"+hs[n]).style.display = "none";			
						}
					}
					F.clearItemLogicResult(nl[j]);	
				}
			}
		}
	}
	
	if((s!=null)&&(s!="")){
		s = s.split(",");
		for(var i=0;i<s.length;i++){
			if(o.checked){
				$("IBox"+s[i]).style.display = "block";
			}
			if( (",4,5,26,").indexOf(","+F.I[s[i]][0]+",")>=0 ){
				nl = $n("I"+s[i]);
				for(j=0;j<nl.length;j++){
					F.clearItemLogicResult(nl[j]);	
				}
			}
		}
	}
	return;
}

F.inPath = function(sInput,v){
	return (","+sInput+",").indexOf(","+v+",")>=0;
}

F.switchItem = function(sItemStr,v){
	if(sItemStr==""){return;}
	var a = sItemStr.split(",");
	for(var i=0;i<a.length;i++){
		$("IBox"+a[i]).style.display = v;
	}
}

F.initURLPara = function(sInput){
	if(sInput==""){
		return;	
	}
	var sPara = F.geturlinfo();
	if(sPara==""){
		return;	
	}
	var a=sInput.split(";");
	var b = decodeURI(sPara).split("&");
	var i,j,n=0
	var sParaValue = "";
	var sReceiveItem = "";
	var aOption = [];
	for(i=0;i<a.length;i++){
		for(j=0;j<b.length;j++){
			if(b[j].toLowerCase().indexOf(a[i].substr(0,3).toLowerCase())==0){
				sParaValue = b[j].split("=")[1];
				sReceiveItem = a[i].split("=")[1];
				if( ",1,2,3,25,".indexOf(","+F.I[sReceiveItem][0]+",") >= 0 ){
					$("I"+sReceiveItem).value = sParaValue;
				}
				else{
					aOption = sParaValue.split(",");
					for(n=0;n<aOption.length;n++){
						try{
						$("I"+sReceiveItem+"_"+aOption[n]).checked = true;	
						}
						catch(e){
							alert("I"+sReceiveItem+"_"+aOption[n])	
						}
					}
				}
			}
		}
	}
}

F.geturlinfo =function(){
	var surl = location.href;
	if((surl.indexOf("=")<0)||(surl.indexOf("?")<0)){
		return "";	
	}
	return surl.substring(surl.indexOf("?")+1);
}

F.initDropDownBox = function(sInput){
	if(sInput==""){
		return;	
	}
	var a = sInput.split("|");
	var i=0;
	var ID = [];
	var o = null;
	for(i=0;i<a.length;i++){
		ID = a[i].split("-")[0].split(":");
		o = $("I"+ID[0]);
		o.setAttribute("T",ID[1]);
		o.setAttribute("S",a[i].split("-")[1]);
		$EU.addHandler(o,"change",F.doDropDownBox);
	}
}
F.doDropDownBox = function(e){
	var oP = typeof(e)=="object"? $EU.getTarget($EU.getEvent(e)):$(e);
	var oC = $("I"+oP.getAttribute("T"));
	var s = oP.getAttribute("S");
	var v = oP.options[oP.selectedIndex].value;
	var i = 0;
	var j = 0;
	if((s=="")||(v=="")){
		return;	
	}
	var a = s.split(";");
	var aTemp = [];
	var o = null;
	oC.innerHTML = "";
	for(i=0;i<a.length;i++){
		aTemp = a[i].split(",");
		if(aTemp[0]==v){
			for(j=1;j<aTemp.length;j++){
				o = document.createElement("OPTION");
				o.value = aTemp[j];
				o.text = F.O[aTemp[j]][0];
				oC.options.add(o);
			}
		}
	}
}
F.initMultiReject = function(sInput){
	if(sInput==""){
		return;	
	}
	var a = sInput.split("|");
	var i=0;
	var j = 0;
	var IID = 0;
	var b = [];
	var r = [];
	var o=null;
	var aa = [];
	for(i=0;i<a.length;i++){
		IID = a[i].split(":")[0];
		b = a[i].split(":")[1].split(";");
		for(j=0;j<b.length;j++){
			r = b[j].split(",");
			o = $("I"+IID+"_"+r[0]);
			o.setAttribute("R",b[j].substr(b[j].indexOf(",")+1));
			o.setAttribute("IID",IID);
			$EU.addHandler(o,"click",F.doMultiReject);
		}
		aa = F.I[IID][5];
		for(i=0;i<aa.length;i++){
			$("I"+IID+"_"+aa[i]).setAttribute("En",0);	
		}
	}
	
}
F.doMultiReject = function(e){
	var t =  typeof(e)=="object"?  $EU.getTarget($EU.getEvent(e)) : $(e);
	var s = t.getAttribute("R");
	var isCheck = t.checked;
	if(s==""){
		return;	
	}
	var a = s.split(",");
	var o = null;
	for(var i=0;i<a.length;i++){
		o = $("I"+t.getAttribute("IID")+"_"+a[i]);
		o.setAttribute("En", parseInt(o.getAttribute("En"))+(isCheck?-1:1));
		o.disabled = parseInt(o.getAttribute("En"))>=0?false:true;
	}
}

F.initPSK = function(sInput){
	if(sInput==""){
		return;	
	}
	var a = sInput.split("|");
	var sourceItem = null;
	var targetItem = null;
	var b = [];
	var c = [];
	var d = [];
	var aTemp = [];
	var j,m,n = 0;
	for(var i=0;i<a.length;i++){
		if(a[i]!=""){
			b = a[i].split(":");
			c = b[2].split(";");
			
			aTemp = F.I[b[1]][5];
			for(m=0;m<aTemp.length;m++){
				$("I"+b[1]+"_"+aTemp[m]).setAttribute("En",0);	
			}
	
			for(j=0;j<c.length-1;j++){
				if(c[j]!=""){
					d = c[j].split("-");
					if($("I"+b[0]+"_"+d[0]).getAttribute("PSK")==null){
						$("I"+b[0]+"_"+d[0]).setAttribute("PSK",b[1]+"-"+c[j]);
						$EU.addHandler($("I"+b[0]+"_"+d[0]),"click",F.doPSK);
					}
					else{
						$("I"+b[0]+"_"+d[0]).setAttribute("PSK",$("I"+b[0]+"_"+d[0]).getAttribute("PSK")+"|"+b[1]+"-"+c[j]);
						$EU.addHandler($("I"+b[0]+"_"+d[0]),"click",F.doPSK);
					}
				}
			}
		}
	}
}

F.doPSK = function(e){
	var t = typeof(e)=="object"?  $EU.getTarget($EU.getEvent(e)): $(e);
	var sPSK = t.getAttribute("PSK");
	if(sPSK==""){
		return;	
	}
	var a = sPSK.split("|");
	var b = [];
	//b[0] TargetItem
	//b[1] SourceOID
	//b[2-3-4-5] SelectDis SelectEn CancelSelectDis CancelSelectEn
	for(var i=0;i<a.length;i++){
		b = a[i].split("-");
		if(b[1]==t.value){
			if(t.checked){
				F.setObjDisabledNum("I"+b[0]+"_",b[2],0);
				F.setObjDisabledNum("I"+b[0]+"_",b[3],1);
			}
			else{
				F.setObjDisabledNum("I"+b[0]+"_",b[4],1);
				F.setObjDisabledNum("I"+b[0]+"_",b[5],0);
			}
		}
		F.setObjDisabled("I"+b[0]+"_",F.I[b[0]][5].join(","));
	}

}

F.setObjDisabledNum = function(s1,s2,blnDis){
	if(s2==""){return;}
	var a = s2.split(",");
	for(var i=0;i<a.length;i++){
		$(s1+a[i]).setAttribute("En",blnDis?1:-1);
	}
}
F.setObjDisabled = function(s1,s2){
	var a = s2.split(",");
	for(var i=0;i<a.length;i++){
		$(s1+a[i]).disabled = parseInt($(s1+a[i]).getAttribute("En"))>=0?false:true;
	}
}


F.getItemAnswerResult = function(iid){
	var sResult = "";
	switch(F.I[iid][0]){
		case 1:
		case 2:
		case 3:
		case 25:
			sResult = $("I"+iid).value;
			break;	
		case 4:case 5:case 11:case 26:
		case 8:case 27:case 9:
			sResult = F.getOptionValue(F.$v($n("I"+iid),1));
			break;
		case 10:
		case 6:
			sResult = F.getOptionValue(F.$v($("I"+iid),2));
			break;
		case 12:
			sResult =  F.getOptionValue(F.$v($("I"+iid),4));
			break;
		case 13:
			sResult = F.$v($n("I"+iid),3);
			break;
		case 7:
		case 15:
		case 19:
		case 20:
			var a = F.I[iid][6];
			for(var i=0;i<a.length;i++){
				sResult += F.I[a[i]][1]+":"+ F.getOptionValue(F.$v($n("I"+a[i]),1))+"<br />";
			}
			if(sResult!=""){
				sResult = "<br />"+sResult;	
			}
			break;
		case 16:
			var a = F.I[iid][6];
			for(var i=0;i<a.length;i++){
				sResult += ","+F.$v($n("I"+a[i]),3);
			}
			break;
		case 21:
			var a = F.I[iid][6];
			for(var i=0;i<a.length;i++){
				sResult += F.I[a[i]][1]+":"+F.$v($("I"+a[i]),0)+"<br />";
			}
			break;
		case 23:
			var a = F.I[iid][5];
			for(var i=0;i<a.length;i++){
				sResult += ","+F.$v($n("I"+a[i]),3);
			}
			break;
	}
	return sResult;
}

F.getOptionValue = function(s){
	if(s==""){return ""}
	var a = s.split(",");
	var r = [];
	for(var i=0;i<a.length;i++){r.push(F.O[a[i]][0]);}
	return r.join(" ");
}

F.createJs = function(){
	var tag = PublicLib.createTag($("oqssform"),"INPUT","OQSSJSFile","","","");
	tag.name = "OQSSJSFile";
	tag.style.display = "none";
}


F.excludeOther = function(e){
	var o = $EU.getTarget($EU.getEvent(e));
	var checked = o.checked;
	var a = o.getAttribute("Exclude").split(",");
	for(var i=0;i<a.length;i++){
		$(a[i]).checked = !checked;
	}
	o.checked = checked;
}

F.initExclude = function(list){
	var a = list.split(",");
	for(var i=0;i<a.length;i++){
		$(a[i]).setAttribute("Exclude",list);
		$EU.addHandler($(a[i]),"click",F.excludeOther);
	}
}
